home *** CD-ROM | disk | FTP | other *** search
- /* format.c */
-
- /* JOVE/MSDOS. K. Mitchum 1/85 */
- /* Modifications for personal use only. */
- /* original code J. Payne LSRHS 5/83 */
- /* Ken Mitchum */
- /* University of Pittsburgh */
- /* Decision Systems Laboratory */
-
- /* Jonathan Payne at Lincoln-Sudbury Regional High School 5-25-83
-
- format.c
-
- contains procedures that call _doprnt */
-
-
-
-
- #include "jove.h"
-
-
- /* VARARGS1 */
-
- char *
- sprint(fmt, args)
- char *fmt;
- {
- static char line[100];
-
- format(line, fmt, &args);
- return line;
- }
-
-
- /* VARARGS2 */
-
- char *
- sprintf(str, fmt, args)
- char *str,
- *fmt;
- {
- format(str, fmt, &args);
- return str;
- }
-
- /* VARARGS1 */
-
- s_mess(fmt, args)
- char *fmt;
- {
- if (Input)
- return;
- format(mesgbuf, fmt, &args);
- message(mesgbuf);
- }
-
-
- /*-------------------------o.s. dependent-------------------------*/
-
-
- #ifdef UNIX
-
- /* VARARGS2 */
-
- format(buf, fmt, args)
- char *buf,
- *fmt;
- int *args;
- {
- IOBUF strbuf;
-
- strbuf.io_flag = 0;
- strbuf.io_base = strbuf.io_ptr = buf;
- strbuf.io_cnt = 32767;
- _doprnt(fmt, args, &strbuf);
- Putc('\0', &strbuf);
- }
-
- /* VARARGS1 */
-
- char *
- printf(fmt, args)
- char *fmt;
- {
- _doprnt(fmt, &args, &termout);
- }
-
-
- /* as far as i can tell, this routine is never called */
-
- _strout(string, count, adjust, file, fillch)
- register char *string;
- register int count;
- int adjust;
- register IOBUF *file;
- {
-
- while (adjust < 0) {
- if (*string=='-' && fillch=='0') {
- Putc(*string++, file);
- count--;
- }
- Putc(fillch, file);
- adjust++;
- }
- while (--count >= 0)
- Putc(*string++, file);
- while (adjust) {
- Putc(fillch, file);
- adjust--;
- }
- }
-
-
- #else
-
- /* clone */
-
- /* these are viable only with the big memory model */
-
- static int j;
- static unsigned char **store[10];
-
- static stab(to,from,leng) /* like a call to write */
- unsigned to;
- unsigned char *from;
- unsigned leng;
- {
- movmem(from,*store[to],leng);
- *store[to]+=leng;
- **store[to]=0;
- }
-
- format(buf, fmt, args)
- char *buf, *fmt;
- unsigned int *args;
- {
- int r;
-
- store[j]=&buf;
- if(j>9) {
- bdos(9,"JOVEFORMAT$");
- _exit(0xFFF0);
- }
- r=_fmtout(&stab,j++,fmt,args);
- --j;
- return r;
- }
-
- char *
- printf(fmt,args)
- unsigned char *fmt;
- unsigned args;
- {
- extern int write();
-
- return _fmtout(&write,1,fmt,&args);
- }
-
- flusho()
- {
- }
-
- #endif
-
- /* end */